<?php
/**
 * Created by PhpStorm.
 * User: wodrow
 * Date: 19-9-23
 * Time: 上午10:55
 */

namespace console\controllers;


use common\models\db\AdminAuthAssignment;
use common\models\db\AdminAuthItem;
use common\models\db\SearchIndex;
use common\models\db\User;
use common\models\db\UserFile;
use GuzzleHttp\Client;
use QL\QueryList;
use thiagoalessio\TesseractOCR\TesseractOCR;
use wodrow\yii2wtools\tools\FileHelper;
use common\components\Tools;
use yii\console\Controller;
use yii\helpers\Console;

class TestController extends Controller
{
    /**
     * php yii test
     */
    public function actionIndex()
    {
        /* 普通输出 */
        Console::output('hello world!');

        /* 前景色，背景色输出 */
        $fg = Console::ansiFormat('前景色',[Console::FG_GREEN]);
        $bg = Console::ansiFormat('背景色',[Console::BG_RED]);
        Console::output("{$fg}{$bg}");

        /* 同一变量设置前景色，背景色 */
        /**
         * 前景色 FG_BLACK / FG_RED / FG_GREEN / FG_YELLOW / FG_BLUE / FG_PURPLE / FG_CYAN / FG_GREY
         * 背景色 BG_BLACK / BG_RED / BG_GREEN / BG_YELLOW / BG_BLUE / BG_PURPLE / BG_CYAN / BG_GREY
         */
        $hello = Console::ansiFormat("Hello，Beijing!",[Console::FG_YELLOW,Console::BG_BLUE]);
        Console::output($hello);

        /* 变量输出字体正常，加粗，斜体，下划线，底色 */
        Console::output(Console::ansiFormat("normal（正常）",[Console::NORMAL]));
        Console::output(Console::ansiFormat("bold（加粗）",[Console::BOLD]));
        Console::output(Console::ansiFormat("italic（斜体）",[Console::ITALIC]));
        Console::output(Console::ansiFormat("underline（下划线）",[Console::UNDERLINE]));
        Console::output(Console::ansiFormat("negative（底色）",[Console::NEGATIVE]));

        /* 用户输入 */
        $name = Console::input("请输入你的名字：");
        $formatName = Console::ansiFormat($name,[Console::FG_YELLOW]);
        Console::output("你的名字是：{$formatName}");

        /* 用户选择1（select） */
        $sex = Console::select("性别：",[1=>'男',2=>'女']);
        $formatSex = Console::ansiFormat($sex,[Console::FG_YELLOW]);
        Console::output("你的性别是：{$formatSex}");

        /* 用户选择2（yes or no） */
        if (Console::confirm("Are you sure?")) {
            Console::output("user input yes");
        }else{
            Console::output("user input no");
        }

        /* 用户输入3（验证） */
        /**
         *required 真假，是否必须填写
         *default 默认值
         *pattern 正则匹配
         *validator 自定义验证函数
         *error 错误信息
         */
        Console::prompt("请输入你的姓名:",['required'=>true,'error'=>'===>姓名必须输入']);

        /* 进度条 */
        Console::startProgress(0, 1000);
        for ($n = 1; $n <= 1000; $n++) {
            usleep(1000);
            Console::updateProgress($n, 1000);

        }
        Console::endProgress();
    }

    /**
     * php yii test/test
     */
    public function actionTest()
    {
        var_dump(YII_APP_ID);
        var_dump(YII_BT_TIME + 86400*30);
        \wodrow\yii2wtools\tools\Tools::log(YII_BT_TIME);
    }

    /**
     * php yii test/test1
     */
    public function actionTest1()
    {
        $data = QueryList::getInstance()->get("https://packagist.org/packages/jaeger/querylist#V4.1.1")->rules([
            'version' => ['li.version>a', 'text'],
            'href' => ['li.version>a', 'href'],
        ])->queryData();
        var_dump($data);
        var_dump(\Yii::$app->user->identity->toArray());
    }

    public function actionTest2()
    {
        $x = AdminAuthItem::findOne(['name' => "测试"]);
        $x->description = date("Y-m-d H:i:s");
//        $x->name = "测试";
        $x->save();
        var_dump(AdminAuthItem::getAllRoles());
        var_dump(AdminAuthAssignment::getRoleNamesByUser(4));
    }

    public function actionTest3()
    {
        $x = AdminAuthItem::getRolesByRole("t1");
        foreach ($x as $k => $v){
            var_dump($v->toArray());
        }
    }

    public function actionTest4()
    {
        foreach (User::find()->all() as $k => $v) {
            $v->generateAvatar(false, true);
            $v->save();
            var_dump($v->toArray());
        }
    }

    public function actionTest5()
    {
        SearchIndex::initSearchIndex();
    }

    public function actionTest6()
    {
        var_dump(YII_BASE_URL);
    }

    public function actionTest7()
    {
        $rmLink = "https://sm.ms/delete/mA5yI9TRsBVSWLapbxMQUDodNJ";
        echo (new TesseractOCR(Tools::downloadTmpFileFromUrl("https://i.loli.net/2020/11/13/y4P7XTlQJ8pqShE.jpg", Tools::RANDOM_NEW_NAME_DOWNLOAD_TMP_FILE)))
            ->lang('chi_sim')
            ->run();
    }

    public function actionTest8()
    {
        var_dump(\Yii::$app->apiTool->baseUri);
    }

    public function actionTest9()
    {
        var_dump(\Yii::$app->apiTool->randomAvatarUrl);
    }

    public function actionTest10()
    {
        $key = "key";
        $iv = "t              t";
        var_dump($iv);
        $a0 = "test";
        $a1 = openssl_encrypt($a0, "aes-128-cbc", $key, 0, $iv);
        var_dump($a1);
        $a2 = base64_encode($a1);
        var_dump($a2);
        $a3 = openssl_decrypt($a1, "aes-128-cbc", $key, 0, $iv);
        var_dump($a3);
        $b0 = openssl_decrypt("U2FsdGVkX18QhTbKJkjKDDRbHpLq7uc5sm3dzTwSjvs=", "aes-128-cbc", $key, 0, $iv);
        var_dump($b0);
    }

    public function actionTest11()
    {
        Tools::yiiLog("test11", null, true);
        var_dump(\Yii::$app->vendorPath);
        var_dump(\Yii::getAlias('@runtime'));
        \Yii::$app->cache->set("test", "test");
    }

    public function actionTest12()
    {
        var_dump(\Yii::$app->uniqueId);
//        var_dump(\Yii::$app->modules);
//        Tools::yiilog(\Yii::$app->modules);
//        Tools::yiilog(\Yii::$app->controllerMap);
        foreach (\Yii::$app->modules as $k => $v) {
            var_dump($k);
        }
        $path = \Yii::getAlias('@' . str_replace('\\', '/', \Yii::$app->controllerNamespace), false);
        var_dump($path);
    }

    public function actionTest13()
    {
        $x = Tools::getWebFileInfo("http://inityii.tc/storage/dev/uploads/t.jpg");
        var_dump($x);
    }

    public function actionTest14()
    {
        \Yii::$app->wYiiBackup->backup();
    }

    public function actionTest15()
    {
        $content = "<img href='http://inityii.tc/storage/dev/uploads/user_files/1/20210407_sBCoI2JNfIF8ebLzIsB3ckzndsn7eI8f.png' /> <img href='http://inityii.tc/storage/dev/uploads/user_files/1/20210407_82sztkiQRE7du7APTAfDoWjL8h9z0Z8N.png' />";
        $content = UserFile::encodeContent($content);
        var_dump($content);
        $content = "<img href='@USER_FILE_GET_{20}' /> <img href='@USER_FILE_GET_{21}' />";
        $content = UserFile::decodeContent($content);
        var_dump($content);
    }

    public function actionTest16()
    {
        $x = UserFile::find()->all();
        foreach ($x as $k => $v) {
            $v->yii_alias_uploads_abpath = $v->yii_alias_uploads_abpath?:"@uploads_aburl";
            $v->save();
        }
    }

    public function actionTest17()
    {
        $x = "https://tb-video.bdstatic.com/tieba-smallvideo-transcode-crf/76_ea4d2d896edde455a95e3a5f9daa6f55
_1.mp4?vt=1&pt=3&cr=3&cd=0&sid=&ft=2&tbau=2021-04-09_d99dde6110038e6d73a4487d4e0c82cf15f49f9d9fa07a31f3351af4b6af
d2d4";
        $client = new Client();
        $resp = $client->request('GET', $x, [
            'headers' => [
                'referer' => "https://php.la",
                'user-agent' => "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; GreenBrowser)",
            ],
//            'stream' => true,
//            'sink' => "E:\www\wodrow\initYii\web\storage\dev/tmp/x.mp4",
            'save_to' => "E:\www\wodrow\initYii\web\storage\dev/tmp/x.mp4",
            /*'proxy' => [
                'http'  => 'http://121.37.179.86:8889', // Use this proxy with "http"
                'https' => 'http://121.37.179.86:8889', // Use this proxy with "https",
            ],*/
            'proxy' => [
                'http'  => 'http://192.168.1.254:8889',
                'https' => 'http://192.168.1.254:8889',
            ],
        ]);
        $cont = $resp->getBody()->getContents();
        var_dump($cont);
//        $_cont = json_decode($cont, true);
//        var_dump($_cont);
    }

    public function actionTest18()
    {
        $x = base64_encode(json_encode([
            'department' => [
                'department_code' => 330109302,
                'department_name' => "萧山区监管平台",
            ],
        ]));
        var_dump($x);
    }

    public function actionTest19()
    {
        $data = [
            ['id'=>"60cab7a5bc3ec712d507989c", 'status' => 10, 'receiveId' => "wwd8839a89670152a0", 'queryData' => '{"msg_signature":"41e269cf2f55b106404380112b2253d84b4d0f4f","timestamp":"1623898020","nonce":"1623352592"}', 'backData' => '{"ToUserName":"wwd8839a89670152a0","FromUserName":"sys","CreateTime":"1623898020","MsgType":"event","Event":"change_external_contact","ChangeType":"del_external_contact","UserID":"FanXiaoYing","ExternalUserID":"woBLBNDQAAXCt4zTNAzIcRsGRWoyP5Yg"}', 'rawBody' => '<xml><ToUserName><![CDATA[wwd8839a89670152a0]]></ToUserName><Encrypt><![CDATA[V8DK1INI8wu+DuAA18yFUhQS+X2+nSaE3TZHpVyiZstmrxw4nuTa++/m671s2eJud0LFfjhaYsfPRoZXJ5l5CCue7i8iOtkYsNOUWp+EWJnMGgxymsvNpYRhBdGDSoEkP8srs3Ev/1ihr6E+qkB8+T6v2TQ73NqLS94r/qxV87OYoKe+EOGgtPR/ZREXgYmH0NePneTZQ7uRqmuhJPEBbODq132lq02dYCe1Ts78N/A/NkzrXY4InEBw9jrYeORRnotcI5i9VzYrTaITbY1a0oQ414t6e8eiWTjemduRDuRck8lttyHcVShA91Aom2GZ9Aof5j+c5+ywYfHqW2Y3fg7B2hTOg0UfcV0JZdt4PPHbX5Nn7SQM+IXZFCOM5gNM9TX2O2FEwVZb5hZBZM+pUjBrCkbAkumhNRoe1pKX3/ec/RtSo/yeytGF0kT/QBGL5GH5MFJtpfw1hA2I9sr/B4ILXnVZFB4HdJlsMX9X9jpd1YXvh1QR3iIzHHubWdoL8Cl/vkqVIQPtsqzfyBxU5SeK1IE9HV0rfooz3LRdJd4djnxQSHceDPKxmZsMyE2XGy5xieVALrxQKt+W+ivQUQ==]]></Encrypt><AgentID><![CDATA[1000004]]></AgentID></xml>'],
            ['id'=>"60cab68e50862c640625337f", 'status' => 10, 'receiveId' => "wwd6411ef3fc3fe88c", 'queryData' => '{"msg_signature":"cdbc59e236789394c0aef5408977757f5bf5b3c5","timestamp":"1623897741","nonce":"1624236828"}', 'backData' => '{"ToUserName":"wwd6411ef3fc3fe88c","FromUserName":"sys","CreateTime":"1623897741","MsgType":"event","Event":"change_external_contact","ChangeType":"del_external_contact","UserID":"LvXiaoMiao","ExternalUserID":"wo2U2ICwAAL4wfj1D1WcS_t_H58pB5sw"}', 'rawBody' => '<xml><ToUserName><![CDATA[wwd6411ef3fc3fe88c]]></ToUserName><Encrypt><![CDATA[NL4NAW5EOLtxubdtXP/8+tMnNXrdqlDBq+s64wxrNZJcqHdxQr1lKDUaQyDPqzHW+5atPWHXvgZcIWRjiOReXmWPRKjZCosZXR5cHrGa1W8mcKCQHhPeyEXjv6zahlEGeBZAU1tO5jJgZc/S6s6nzv4ZNJGBK99DZk9hHmLTpJS7TZshnPshweprFTfyUOpal/YCzctAbx+VBvEqd7Ne+4TEM+q8c2G6vYm/hMxBOo9HJxpKUcGUn7NQOBNj6pS2Sgh1/5POWtIq4HR9OZsJWaqaHmcCY1cab9vrrdV/2Nzjaqegj8/yNMmSnHfAs39hlY/ocZHt4A60Bn2MpuRLGb30JZxvQTghMXZBDgrG5+nhKM3luTiRUkyeU91kw3eh1X7C4wGQEZeQvXR25vpikTFzFcMWun7gf1dy6tp0GX5PEGu0oH1IfLwrjnlxjFxVWofqi1tBrQKx9aL5B0C8Fi2bAvgkqkhPyBPd6u3NadTXHajmkGGYGNji0JFhIMjxG3fN4pL+eVwEPolPHr/v1dnEyDrg7zznHBuy+OrvwpTCH+aZY4SEaD0hlu4GVAkIUT9q6fUNKy1hbzMMGGR8iA==]]></Encrypt><AgentID><![CDATA[1000005]]></AgentID></xml>'],
            ['id'=>"60caaf4b6388744e030c0f44", 'status' => 10, 'receiveId' => "wwd8839a89670152a0", 'queryData' => '{"msg_signature":"db2f0e9ee4e69e148f906fd7136fb33c7bd222b3","timestamp":"1623895883","nonce":"1623334864"}', 'backData' => '{"ToUserName":"wwd8839a89670152a0","FromUserName":"sys","CreateTime":"1623895883","MsgType":"event","Event":"change_external_contact","ChangeType":"del_external_contact","UserID":"FanXiaoYing","ExternalUserID":"wmBLBNDQAAxMQXfmtReDz9vJ98V6hz6g"}', 'rawBody' => '<xml><ToUserName><![CDATA[wwd8839a89670152a0]]></ToUserName><Encrypt><![CDATA[9pzBMJ21MaAfO3J3maw518afdpAkav3hyuvZ9O5K2n4vvZGPYVaMRypBsaJ8/JHKpuB+NuT61rkv6wv60H/eZwtZvVrcuRcK/1ltfPKuscvedvYxbTYq0e7useu0D1TbNE1QUt5YozjDlBTDJMIKACoCzlHY7f7TJ6fGJXK5GQFwgD0AbQupyuOvL4wve6cGgXpT3CQ2RjF7Mscc5sTPvPIjx65IOesDtqU+NkZsRij3WG2fXdIDEGjRMbnpOP/yaT32SWZXqOtMoBo23rJYZpKDGwCX15m7t/1BOTNXx5Rm68nZ9O+6YlKURhM/KaIIf/ROXrJGuJz+PTmBRb1Qs1gdWF8m+PnF1Jc1ueBRwh96Ydp0DLNy7iNpDdwAKUEcCP50ioKyYZjhVbFMskL8Zxm0Q4d/lwtkkbvhb5zsYH0I2j090VXljn3+D+s7bO1GT2spEjs4QrO5Wrxlgq5yK0M1iKes6IlzLreclZZD6BprzU+3/c3lkEOIy68o8nhydIqjL5LtL5e8lCl95rvKiTCPRqMeKRwbCmIBZpC5bmxxA4QOsaVSpPh33PlReLQ/OHCKtECTuSlYV6wOSf7XhA==]]></Encrypt><AgentID><![CDATA[1000004]]></AgentID></xml>'],
            ['id'=>"60caaeb9c7434527a927a97e", 'status' => 10, 'receiveId' => "wwd8839a89670152a0", 'queryData' => '{"msg_signature":"0cfb2ec6bf11ce85b6c222ff4ee5d217f2f092df","timestamp":"1623895736","nonce":"1623269047"}', 'backData' => '{"ToUserName":"wwd8839a89670152a0","FromUserName":"sys","CreateTime":"1623895736","MsgType":"event","Event":"change_external_contact","ChangeType":"del_external_contact","UserID":"FanXiaoYing","ExternalUserID":"woBLBNDQAAEZpzFwtsJ_yE-9lT96XY6A"}', 'rawBody' => '<xml><ToUserName><![CDATA[wwd8839a89670152a0]]></ToUserName><Encrypt><![CDATA[QFIzE6ESNQRy+ndMS/brfNKPFmEP06crV4jA0Kh0bvbs1Coec6s1p53/rJP6+iKMTXwRLM/llMsbNheoTo7u8aQ91/wbkIT0bzcUShvTjsYjXYgWAfl+oHoPOH415oVP4ZNckzGrwJSUIjCwvV8fGZP+NwmvRZzfuvK19n12dPu+CW/qLzoanuOu2P4+v77NKjZheWxb3F13RDPO1br4cSd7PDynRgFBqBnxme2r6ULzqPwxxt3qQXxPOv5fYHG7Xcal4bYejdjcsQYUAALJRfkHqfxmBHcltVPrRMQjhwpG6gp6H8BhQzDWhcdTMrnq4PgDlWgIR0GrWv1OPE5ABnzQuC7C82LrK937mP7us1ouisqiehMdpiXs5FVqdUVEhAUiBIyGoxxwxW3LG5oOPy0rPbtMQNMjMCes0adWlQ3Hq86gOdhYVt871YoTQKwf0Kyw/9G8sJSnvd6Y73cWhQqYBq0jaHmC9AZMHIK9Ro6KQb/q1Cn4OVZbpiTHEasLMpVDFLhbd4ps7BcHlRcbwUDojTG7270DzAZjBqch+nx0p6SOIZeJNoq913bXnqPTexyJa5rGvucVRMdfgmr/RQ==]]></Encrypt><AgentID><![CDATA[1000004]]></AgentID></xml>'],
            ['id'=>"60caac71900d67133353cc31", 'status' => 10, 'receiveId' => "wwd8839a89670152a0", 'queryData' => '{"msg_signature":"01b2bd2e5b3b5441e67243c54722d85fbcd3d51a","timestamp":"1623895152","nonce":"1624088098"}', 'backData' => '{"ToUserName":"wwd8839a89670152a0","FromUserName":"sys","CreateTime":"1623895152","MsgType":"event","Event":"change_external_contact","ChangeType":"del_external_contact","UserID":"FanXiaoYing","ExternalUserID":"woBLBNDQAAEZpzFwtsJ_yE-9lT96XY6A"}', 'rawBody' => '<xml><ToUserName><![CDATA[wwd8839a89670152a0]]></ToUserName><Encrypt><![CDATA[XbBUqnG+ZoKVnrfzjrs8gKkfSMC4Zu7Lmmc7s/+B2f9oSLo5mgDSNqxz1m0RfYqUCqlzTSzoodjU/tCBYTehiDU91mO9o6CTcrsTyWXkZcpr+FZP4fRNrvEwSNB3f2xfe+Ed5L3RjRrj+v7lKEA+OeSbkIrvaR4pK6JHlcGF/1FV5lqcZWH6jE5gOhVuMyIqCVTvuBXXKRHUuw9GoS7CSdkmQ3dlZ7w8AamHRzfVIdOhDQB1uvwSsP2Gs1ibsd+S3YgjU8XEWbniTjWOqJeMSxtH90VnTvtHlvWH3dYINrdqqlKkd+m5YxebCNleAQ1WQr/2Glp74djN3h4dgmD17GvvZjf2bHk+8IEdtU2uPfc66d14zOxt3ppo31Rw7UcSSdIBcFzhJdvOMMo7GCQ1cThJLVnlFxJ4OqL//+enFu/oNLYL0S3uANKo/fM8a9KUM29xkh8iuR8jtdA90kZGhxVUdRVTSzXTBDSXprxaolaJdQrUSf8ouUIz8P2DgDnua8Din8o0h2YmkDYiwEG4bhaGJbSLRelimh9YBPUvcEQV3SfHposrORji7dPv8P80+X+8W4XmCXA9QnlWAfV4QA==]]></Encrypt><AgentID><![CDATA[1000004]]></AgentID></xml>'],
            ['id'=>"60caa4e4a3cee013c15ced7e", 'status' => 10, 'receiveId' => "wwc26953f1d721206b", 'queryData' => '{"msg_signature":"fe340aa1246999e17382e365717c725be5f72b99","timestamp":"1623893220","nonce":"1623875712"}', 'backData' => '{"ToUserName":"wwc26953f1d721206b","FromUserName":"sys","CreateTime":"1623893220","MsgType":"event","Event":"change_external_contact","ChangeType":"del_external_contact","UserID":"WangRongTao","ExternalUserID":"wm5Tg0DwAA2XDqlPziFMt48MbprOhCJg"}', 'rawBody' => '<xml><ToUserName><![CDATA[wwc26953f1d721206b]]></ToUserName><Encrypt><![CDATA[1BN3ytsw7G6JBN+zsOM3Skuz24DnVJLt9rhDDkjgeEUW0ODbCYwPQ2GRwvqhzL/9Go0XpGQ/t3bUd7DrnPrg5O5ybLz3prh1uq0d/vvdDM6LxZpg8kHO8t/sl4jOVlRlQPU2+tr3NfyTZxFfeEOmGWPw/GzDl2EWT8mr0N4UZ6VVL0VNumbVUHV9wliKGYl529Ho3uEWLt4XZK8F/3Lybw23dhHfW3d8PhoHeoCf8AjvVjmWWtIt59Tfdrj8MuhJnxz12FmK0P9LV4lju3jeVV0Pzu0vvXJpkw58NkCCfGP1smoLJp2SGSnHJUUl8p2cbI6rpT+AhnrCx4Extf0PkVX1dgYXK/UCMXUhYq3fJi+2kZdM660kLyRudD0w73BYu2I/6NrNwiOGn9fK80B1S6e0aByzdbqWeCmVHQ0+XgANDn1+79iNuz7WYeK+hRrjnk5RHA51sMZVmHfeW0rZp7ZMdnAeuP+PjIfalEGVtBZuswv19Nz/UzBylpnP/bdtF4Fes/LzcPoKn+IMcTzYY8wEVYOQxK2G1tR5CxjUWaM8jtiBQPYozDa0gqXyq4tktx2Vqdp2q/6RrL1G4IJ3Eg==]]></Encrypt><AgentID><![CDATA[1000003]]></AgentID></xml>'],
            ['id'=>"60caa1126cc6263d510be383", 'status' => 10, 'receiveId' => "wwc26953f1d721206b", 'queryData' => '{"msg_signature":"ce59082cf6cb8aa9cd66b338964686ff714e71a1","timestamp":"1623892242","nonce":"1624167981"}', 'backData' => '{"ToUserName":"wwc26953f1d721206b","FromUserName":"sys","CreateTime":"1623892242","MsgType":"event","Event":"change_external_contact","ChangeType":"del_external_contact","UserID":"SuFan","ExternalUserID":"wm5Tg0DwAAoUlLEPwQ777zpHMX_j57uw"}', 'rawBody' => '<xml><ToUserName><![CDATA[wwc26953f1d721206b]]></ToUserName><Encrypt><![CDATA[WMk3QeuKUQ6G9txigD12Q8o1oHE5HUXkCbTjTE7O9+f2DgZys0FECz96cRjZmBxHEN0c1zJdlDBBngyTssUWgYUJpltm5eeOTenyWhJ30tt/wGK/5u+XFMoMga+pYvVk45ozUp6zJJyrqNHd8tECNE5cwX+onA5/linJeiYVwDeCNlyXEjqxXJDHCWFOPidvgWSUb9Nt0Fup/eMCxbZ7nZ9v5ONwHIZ+dU8eWvUIyj/qIn8l+alkzhO/IWZ8VEe/5a6p3+kMePu4b69+V4XhQ/6kxt1dbSRwmj3M+SZzJ5ahmivd1lXiQoRjxwwm9Z0xLrdkqiQ5UbH5v77oCtjWD/tRLhu1rDKCID/i7RN4xGwtHXGzpNaWLp9ACybOUrdTOyvdg0oDTQD7NekYYxxfjWZylfEqFjCWB9NSX0Stmty4QWK+hG0G/BNbXbLqAlJJw2XP56riT+Kk5rVmltduSXE9J0WiD1ymlS96CzomaK6Fo2MwzxRjzZpvhtkEfT1n9QxDwYwca5T5BLPKPg/sOPHFaPtNYzWdNzIjSrlbPfAGrlSmU7I1bvEBnBzKlrSAkX/X1zPIeOAvzOPWWEYs0w==]]></Encrypt><AgentID><![CDATA[1000003]]></AgentID></xml>'],
            ['id'=>"60caa105a3cee013c15cecf7", 'status' => 10, 'receiveId' => "wwc26953f1d721206b", 'queryData' => '{"msg_signature":"5f7b3dde95b7981dffa9e9b4a4e5f7e75821d59a","timestamp":"1623892229","nonce":"1624144464"}', 'backData' => '{"ToUserName":"wwc26953f1d721206b","FromUserName":"sys","CreateTime":"1623892229","MsgType":"event","Event":"change_external_contact","ChangeType":"del_external_contact","UserID":"SuFan","ExternalUserID":"wm5Tg0DwAAtykRiBkx2JdNJ5L25xIYKA"}', 'rawBody' => '<xml><ToUserName><![CDATA[wwc26953f1d721206b]]></ToUserName><Encrypt><![CDATA[xeZE+ck9Gd4rgEHIOqR2lxffs3b1u9qrBu1IW4gaWHK6LjHHtobKWKUGTFwSUs/TnAatiPHIK9vPjnYaQAoH3oBkycTY7Kj7mb2BmHUaEA0ZCSF3QH99Wx/p/Ua+v3lKmwtT3HTcERHXu91Br4As1oWeokYRhqt8d3sv7Ik6N8IQ+cg0zCdodcZxe0qKV52lwpLevMzVs+aqXSu/djWREcIhMMneNOYbGJFzfjdUHRt7dCr1Q9RXGRmgxiHgJLZdoOSrY+4eL3JQhMUhw9NRX7aAXxcVwQ1hh9EMN1cOI68+wEyIsgo80RoLnt/DZLkyIb4fIC0AItJr1U4BphKCX3+bbY6Uyj/0PdWcilihkF/afdyFQpgeVJOzLaLafNaxi6hNpLEYNOUl68hHaGanEcFZ8OfsLZoa9anLU19AGV70fBgDyF4Sc4yJvN4WQcvmf6GzGA5TIHy6Fj7WGTPnYiFPjRBITfkBaovcJ+WeJTNHhGxa+Tv8M35WvJYsFwMZSfXBOZrFxY/hqzYesk99gLYLThfQIForMELfN04Mrd3slQ7O4LYOje4tJOWUP9oWuL82i0VN/UzGZfOB1JXxFQ==]]></Encrypt><AgentID><![CDATA[1000003]]></AgentID></xml>'],
            ['id'=>"60caa0f7a3cee013c15cecf3", 'status' => 10, 'receiveId' => "wwc26953f1d721206b", 'queryData' => '{"msg_signature":"c0aab1b35b1f7b499f2ec3b954da31b8e626fd13","timestamp":"1623892214","nonce":"1623288752"}', 'backData' => '{"ToUserName":"wwc26953f1d721206b","FromUserName":"sys","CreateTime":"1623892214","MsgType":"event","Event":"change_external_contact","ChangeType":"del_external_contact","UserID":"SuFan","ExternalUserID":"wm5Tg0DwAAQ5enSKXPNWTZeemDEAB3GQ"}', 'rawBody' => '<xml><ToUserName><![CDATA[wwc26953f1d721206b]]></ToUserName><Encrypt><![CDATA[wo4eL5g21XKvvRhvE0Bjy/UorljP4+f5hWW5YXiA7vBg1AitiB1jAGUg++RqJnfm+GhDceFpM4lBepwHan0kyDXyk/KM+xaGcDRSS2ni6G9zhb735Ps64vSlXo4qdk/q5KNGvc4CS9flzLTuc8RPuC1SMBbFDfpYdow3QAisKrgfW3P72SuteYsFxMG6aDYVDaNtAYGhPf1LIzW9lqFPYVMI9XqLOsulaXSyyDcGR5OUMi9f2L1C0kTB97RKI8GW/j25sezVmvE3q+hmCg0n/XDVhF8FjIaPhqfJ7LHEhFzDcVzmw2Hhzdp2XVgiDuLy7TOowwdXcN1c2+RNGAnrIFil3d7hmuqk+UI9imujNQ9yX0DFGg7xfay/RnM+Q7cBd6DY7Fc5v8jYACRkmYp1HHQPeyEHCkd1tEybmrBQKoqYnHBR1xyvqNHRFEgMwV3+6clZ0ecbujR8qP8FNYKPrLoWvmmW110MNqF/K+KlrrG4+MW1TRPLiAWZ3Hs5mtJbsxZhCjbn+wW4sI5zKqk4rYm9XTt1l8bQPQiVICIDep8DB2tcaHAsyGl9kuSnMzIJ59qxAJFsT0AgdT+cSw+XWw==]]></Encrypt><AgentID><![CDATA[1000003]]></AgentID></xml>'],
            ['id'=>"60c9ad69cfb5e731953767cb", 'status' => 10, 'receiveId' => "wx2cb256f75fff96d6", 'queryData' => '{"msg_signature":"63fa3505b21b2d921992d2ade48378175c3d3bad","timestamp":"1623829865","nonce":"1623327238"}', 'backData' => '{"SuiteId":"wx2cb256f75fff96d6","AuthCorpId":"wx855bae66868f851a","InfoType":"change_external_contact","TimeStamp":"1623829865","ChangeType":"del_external_contact","UserID":"ZhengHanBiao","ExternalUserID":"woIrYPCQAAZq9Vyu4GSp5jlOf8donOaQ"}', 'rawBody' => '<xml><ToUserName><![CDATA[wx2cb256f75fff96d6]]></ToUserName><Encrypt><![CDATA[qY4IHWGSpLYIsiA/ABrAPQNXnmRT83m4p+QauFo89QFfJZvBOlQZ8ZeETRZPfsZ11v1uUhoSMkSjbsr7Ahggo8QTvV/zN/wScXGnE4RySYTlPEZvF14+bdWT6l+T88CBMO1gnljzp81L9svAWIRzSlVBEcnjDrIkJrsHairZLB4XcEXnYkDNJfb3F0tD+1TTj42aavCamVH7eVnjGwuOw1EngKdwuQj4jQAK4s627U6g5YRUVl0msBROTTY5mTbU+maFxKeWmq6x2BBs3vCfbwSE5A6iDwRBfwLH4nIqXMh+a6vCtww/PG2Nm7xEE1Hj0q0zOF8Tr2RjgtlV/fVUny8GE/Me4ow5nombpEwM+3GuFC6mVt1p9JIWum13mSVcSVXRqKDzkRiR2lYbf4PneeHL6mXk7eh54Klq7LZrnChQK724OBW6UCwZ7UfwVNNgW4oi65wQN6WDRu7OBzkrGw1vzwn3nnugRI2T0rCtVmxef1TjpNIN95S0jsumbP07E+iSMGL43osVQI6Z2e/hwouniqJnRTkkuPNohBrimlE9U8yDJ43OibfY3d1B+UBLk+MdyERbhlldqkZQtYkthw==]]></Encrypt><AgentID><![CDATA[]]></AgentID></xml>'],
            ['id'=>"60c9ad69677aec4e7a5004ad", 'status' => 10, 'receiveId' => "wx855bae66868f851a", 'queryData' => '{"msg_signature":"2c5665225551d402bcaa1d235045dd8aab5cd812","timestamp":"1623829865","nonce":"1623341216"}', 'backData' => '{"ToUserName":"wx855bae66868f851a","FromUserName":"sys","CreateTime":"1623829865","MsgType":"event","Event":"change_external_contact","ChangeType":"del_external_contact","UserID":"ZhengHanBiao","ExternalUserID":"woIrYPCQAAZq9Vyu4GSp5jlOf8donOaQ"}', 'rawBody' => '<xml><ToUserName><![CDATA[wx855bae66868f851a]]></ToUserName><Encrypt><![CDATA[307bhfgS0RiUt+VMkMd3djXnUIoTkgdztqHUpTRP/sN2684kswjI1ieVYPe1wf4tCkXqmaxVhO8uPLwxZUkEblTPtBh25ZT5HkqG1IkFWubGB+O11M69NTmCyr6JYgtr7L2cxdaRnE6a66RaxWv27JYa2NiPwyq2JXgG1aU1qEhG5pWUfgk743ERBgdoxBL0zJe85f9HDh7poEizSbhLnZVmAQTkEEJjDnnGQFqsZ1Es9RZw+ttKdQ9hZQNZwyibutocZJpsK0Yv5L0FQJFXj/MCL1wcwMtp0JZlaksMths+Q+id2gIOncfvfa24tuQCmcOUxbWeX6EGJSt2bzUIN46gJcpxi6ccRMwvcm/UjRcEqfYuatsUvnE0smXLlWN14AVLsZXjrLr8BwMLFrCy/AdTygvYTGRtAjtEUDBTK4szcX+rHUbUpvKyMX8cAb/iPQZRWBbM7oMvxUMKyZSquR7xLYBynOCZoWRXtOupwN1s1pZsCvOOSzDalADEKmJXL5SbGkJl7LSaxxQC/KV1OPJMUCbBrTc1Q5o6h9mP7C/y4RkgtNsrm1bYb9KhTDV7lb1e9FKzkE1lAyryFVFT9A==]]></Encrypt><AgentID><![CDATA[1000056]]></AgentID></xml>'],
            ['id'=>"60c9ab83cfb5e73195376765", 'status' => 10, 'receiveId' => "wwc26953f1d721206b", 'queryData' => '{"msg_signature":"c2209b539afc66be24701af2f23eb8f85c346383","timestamp":"1623829379","nonce":"1623536747"}', 'backData' => '{"ToUserName":"wwc26953f1d721206b","FromUserName":"sys","CreateTime":"1623829379","MsgType":"event","Event":"change_external_contact","ChangeType":"del_external_contact","UserID":"WangRongTao","ExternalUserID":"wm5Tg0DwAAD9G8-s42jaKfH-mpsCipiQ"}', 'rawBody' => '<xml><ToUserName><![CDATA[wwc26953f1d721206b]]></ToUserName><Encrypt><![CDATA[ugMJqVQin0dXZTR0AUaW/tTor1YiXX6bYHvyE4iuxmDaCe3d56Tk3GufypA0l67e10G3Cl4ScQ15z5KvdZnp017ejpk0+FaRoyIAKShiS0k/9Ia0AkWodzQfHJr6dewm9X5d6f8x9ShwCWUgeCKyJVNvrFJ4ZuK9jIYFGNkp5F42PfpR+SCDRStRMz0U5lekjSQPH3yxvQToL/XlxqLbfc2XRhh0iGoPXvw/e4Nf/ncfzLpDj68mdAwjND1GSENKp072vzqLNuJ8jXuecDpEenclmZ1Jt5QbfctI4OKQmW0jqBTcmAVTVG+/+CJ6DzDu+Q6ZoguNy2sQnUXC752lS80CgvGcJZFTiWDcPjn+4iSqtKimJGfgYIX8gll/gM+vZu/Vxl5zKNRrOO7saSKUb0LaXAi+aCEipaiOVhWXUkN7DB8ye5vMJzNBcnnIbklxEBKj0nMqWKiZwg1caXgSOJ59JRujI3odUQMFz7fyTI41ghB7zfuUcCg5sbAOExXt7d/8zuEvQ6Pmrj5CKlOAn7zcf9OdXyaAQMkwcrKUp+wCvGKbfBRnoheqeZ2xqV6P4L/RSlbPt6ABc0ufKt6JnQ==]]></Encrypt><AgentID><![CDATA[1000003]]></AgentID></xml>'],
            ['id'=>"60c9962f1fd3480df755de5a", 'status' => 10, 'receiveId' => "wwc26953f1d721206b", 'queryData' => '{"msg_signature":"25e0ec1d300c4133091bc7a11ff3919ab1e3f53e","timestamp":"1623823919","nonce":"1623293092"}', 'backData' => '{"ToUserName":"wwc26953f1d721206b","FromUserName":"sys","CreateTime":"1623823919","MsgType":"event","Event":"change_external_contact","ChangeType":"del_external_contact","UserID":"WangRongTao","ExternalUserID":"wm5Tg0DwAAzgh9MtJfKiswbzd1HxfEcw"}', 'rawBody' => '<xml><ToUserName><![CDATA[wwc26953f1d721206b]]></ToUserName><Encrypt><![CDATA[xaV/sqesWcgUUrupBNfbQmSn5bMCPPcjCA+DFLEtdNnmCUz1pWjggv9xyhop2WC5tEw3zCgpM4HH3v9CDbpbPjfivs7WpeZnWFVfiJIzXae8RwOfpFae1/jGrfcYT2Kiz7vgDTNddBGt+y1xKO08LOajbDcR1CPPDaG8hTi2YlNNmslSIwgAzToWgyi8bmVgZHHz7OjowGR/uRZ1KjpgGN15dOHRuDebkHkp6qoIEoypkAgLRCzQRToMbNatKTJvtBox/Qw7UJmcJOu62jg6fqSCi0bbPvMMUnq9mbZKLt89tPgp14zuMBiAwIrx03bRP6mnTH0irW2dRdxmAf+rzBEraWVKh9APHoAMo6JSc6fG+dEPOoFlhc3zb74K+KZLNsQk+KTruEV2lE0gTfviuv4Qca8FOoQR/DPi4RuevKdHjL5QcFeQigR8aMM061bpV7bfS+KjDwrSpXtbR5/MROjZ9pKwTmy6ahKYcONpurbiNOX/NU+qQDG060PutDfmddZYu4f39v7ephxGX3zx0znb8JI64DNtbGNoUtrlnkaGC2zkcogkKJKI1LSxnNYiFvR5nMZ71yYvKz4I7FdwHA==]]></Encrypt><AgentID><![CDATA[1000003]]></AgentID></xml>'],
            ['id'=>"60c995c1bce482595a7b7f3f", 'status' => 10, 'receiveId' => "wwc26953f1d721206b", 'queryData' => '{"msg_signature":"59ba523e8afed850dcd08ea9fac64117871eef72","timestamp":"1623823809","nonce":"1623522242"}', 'backData' => '{"ToUserName":"wwc26953f1d721206b","FromUserName":"sys","CreateTime":"1623823809","MsgType":"event","Event":"change_external_contact","ChangeType":"del_external_contact","UserID":"ZhangNingLin","ExternalUserID":"wm5Tg0DwAAdSJ-B-5Efqapv5K_ErmOsQ"}', 'rawBody' => '<xml><ToUserName><![CDATA[wwc26953f1d721206b]]></ToUserName><Encrypt><![CDATA[F+xu7QXHIY+VodQCIziHwMaddkE3G7rFzTiTJgOZV2H3g0wxOgOR6ZfA93kOMApelhraItRCg2OPoT4B5MkOAQ+Nff+8lvlTkoMLkBHLGBYdMKnyubFvPXYSBksxxpE2K8YFA0NxWbqbrRLyZjIPauF2z9oCunnIte13yR0L3qSoXLkl3S+fErCqa+SUYRP80AJ+ppQ/CfD8+Z8sZZpGgYJJhBGVv8f4BDO/HZwIJMTFkJHUpT+8GmcV2wF7JqhvL/QRYV3eFZMBOYi876ptSWW0AgsZmQckZICJ/ru18uA9IProxIS4TBQEbCNETG6wzSlSsbg+jdt0/bSjcZ3/kKLY3KKChejd8wGd2yUm7+JYtO5vUZbxsoo8sjEMAj1aMZ6eK8Z5DlMHWR9wxccDELe7ZBTgr2sJd3D5gIPecl8EQvo1yX/0+S97tOpj8NbkBUggmoCybGVT8nBoSYv+u9+h7XpzvYrb6PPAhMKU0o5m80x1yaZxj5RIFvO1UHO4hsnpivNxslDpaQ7ng7y3Lwh9DBLHpRwkIeICUnhcbS+AUA5aX9DkdjrTTc7X2n9PUIQVA/IHb75L31Y0WJ8HeA==]]></Encrypt><AgentID><![CDATA[1000003]]></AgentID></xml>'],
            ['id'=>"60c8e4087b47db744410c472", 'status' => 10, 'receiveId' => "wwd8839a89670152a0", 'queryData' => '{"msg_signature":"5c34f5a97576cc403a5e3b5770340d2e60cbb117","timestamp":"1623778312","nonce":"1623817303"}', 'backData' => '{"ToUserName":"wwd8839a89670152a0","FromUserName":"sys","CreateTime":"1623778312","MsgType":"event","Event":"change_external_contact","ChangeType":"del_external_contact","UserID":"FanXiaoYing","ExternalUserID":"wmBLBNDQAAxMQXfmtReDz9vJ98V6hz6g"}', 'rawBody' => '<xml><ToUserName><![CDATA[wwd8839a89670152a0]]></ToUserName><Encrypt><![CDATA[7AbPOwNPQ3zqxxQD4WNrGJOl6+IXRNBujni/kqntstKmzxIumCvvKHMOVwmwqLyAbmm1/QtqJghvuL2wCxJQ/NrcpT7XLBAQ1YUdHKytcDPbwMJV2mT+6EOL0qCXpfBJUbdgo0zBy+5UIxR0BH1g+t3pwyN96rdyosAuAkM7wZ9DDwcP010+zWAQaFfLo/luE78h+4ozSpKjyb7wlJhkQTk4SueMpisjju0FkwXYn0Adjp/PIIJbtg+AL9Nn63BbQ3p+LLn0hkHOjge3f/GvCFMYU+bzwkEzn0RMieLWXZv0MQEerD2/fFR2el38ShfKOrT6OpgIb+1AJ2wourJLfaT8cWtncrvve3g5CJkJe4O0FugX47N0cCEyTmsZyss5PRUxvoei9Yi+B/nqaVNaxfsgw4yTrlW6hzz3KV4Ctu94vG4uaFdk//TlS8nX05sg8W5m46LaXg9tSoBuqhCuACnSyZP4P1Lsh/5WpuphBV1eV3lpECc2rxyOtO/qoP1rbYkx4cSWYmakQ3CJ6q6wq5kfxCgBlMRZH4zOYt4OouXQRT7MpttU8cfyJmHLA+q/z21OQcmcH43wf2mlp1QMeA==]]></Encrypt><AgentID><![CDATA[1000004]]></AgentID></xml>'],
        ];
        $dates = [];
        foreach ($data as $k => $v) {
//            var_dump($v['id']);
            $timestamp = hexdec(substr($v['id'], 0, 8));
//            var_dump(date("Y-m-d H:i:s", $timestamp));
            $dates[$v['id']] = Tools::toDate($timestamp);
        }
        Tools::stop($dates);
    }
}